﻿using System;
using SimpleWorkflow.Data;

namespace SimpleWorkflow.Steps
{
    public abstract class ListenerStep<T> : SimpleStep<T> where T : ISharedFlowContext
    {
        protected ListenerStep()
        {
            WorkflowContext.EventSurrogates.Subscribe(EventName, Fire);    
        }

        private void Fire(object sender, EventArgs args)
        {
            RunProxy(this);
        }

        protected abstract string EventName { get; }
    }
}
